package com.zjsy.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zjsy.po.Message;
import com.zjsy.service.MainNewsService;
import com.zjsy.service.ServiceService;

@Controller
public class ServiceController {
	
	
	@Autowired
	private ServiceService serviceService;
	
	@RequestMapping("/service-ad")
	public String serviceAd(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findAd();
		req.setAttribute("context", context);
		return "service-ad";
	}
	

	@RequestMapping("/service-about")
	public String serviceAbout(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findAbout();
		req.setAttribute("context", context);
		return "service-about";
	}

	@RequestMapping("/service-contribution")
	public String serviceContribution(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findContribution();
		req.setAttribute("context", context);
		return "service-contribution";
	}

	@RequestMapping("/service-culture_wall")
	public String serviceCulture(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findCulture_wall();
		req.setAttribute("context", context);
		return "service-culture_wall";
	}

	@RequestMapping("/service-picture")
	public String servicePicture(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findPicture();
		req.setAttribute("context", context);
		return "service-picture";
	}

	@RequestMapping("/service-propaganda")
	public String servicePropaganda(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findPropaganda();
		req.setAttribute("context", context);
		return "service-propaganda";
	}

	@RequestMapping("/service-subscribe")
	public String serviceSubscribe(HttpServletRequest req,HttpServletResponse resp) {
		String context =serviceService.findSubscribe();
		req.setAttribute("context", context);
		return "service-subscribe";
	}
	
	
	
	
	@RequestMapping("/editservice-ad")
	@ResponseBody
	public Message editServiceAd(String context) {
	    serviceService.editAd(context);
		return new Message("编辑成功");
	}
	
	@RequestMapping("/editservice-about")
	@ResponseBody
	public Message editServiceAobut(String context) {
		serviceService.editAbout(context);
		return new Message("编辑成功");
	}
	
	@RequestMapping("/editservice-contribution")
	@ResponseBody
	public Message editServiceContribution(String context) {
		serviceService.editContribution(context);
		return new Message("编辑成功");
	}
	
	@RequestMapping("/editservice-culture")
	@ResponseBody
	public Message editServiceCulture(String context) {
		serviceService.editCulture_wall(context);
		return new Message("编辑成功");
	}
	
	@RequestMapping("/editservice-picture")
	@ResponseBody
	public Message editServicePicture(String context) {
		serviceService.editPicture(context);
		return new Message("编辑成功");
	}
	
	@RequestMapping("/editservice-propaganda")
	@ResponseBody
	public Message editServicePropaganda(String context) {
		serviceService.editPropaganda(context);
		return new Message("编辑成功");
	}
	
	@RequestMapping("/editservice-subscribe")
	@ResponseBody
	public Message editServiceSubscribe(String context) {
		serviceService.editSubscribe(context);
		return new Message("编辑成功");
	}
	

}
